package com.ltkj.shop.controller.mobile;

import com.ltkj.common.core.web.controller.BaseController;
import com.ltkj.common.core.web.domain.AjaxResult;
import com.ltkj.shop.domain.ShopPostageConfig;
import com.ltkj.shop.domain.vo.ShopPostageConfigVo;
import com.ltkj.shop.service.IShopPostageConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮费配置移动端Controller
 * 
 * @author xupf
 * @date 2023-08-29
 */
@Api(tags = "邮费配置移动端接口")
@RestController
@RequestMapping("/mobile/postage")
public class ShopPostageConfigMobileController extends BaseController
{
    @Autowired
    private IShopPostageConfigService shopPostageConfigService;

    /**
     * 根据收货地址编码精确获取运费
     */
    @ApiOperation("根据收货地址编码精确获取运费")
    @GetMapping(value = "/getOneByCode")
    public AjaxResult getOneByCode(ShopPostageConfigVo shopPostageConfigVo)
    {
        ShopPostageConfig config = shopPostageConfigService.selectShopPostageConfigByCode(shopPostageConfigVo);
        if (null != config) {
            return success(config);
        } else {
            return warn("不存在当前地址的运费配置！请联系管理员进行设置！");
        }
    }

}
